package GUI.Administracion;

import java.rmi.RemoteException;

import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

import service.article.exceptions.ProxyException;
import GUI.Cliente.MainCliente;
import GUI.Productos.MainProductos;
import GUI.Productos.MenuProductos;

public class MenuAdministracion extends Dialog {

	protected Object result;
	protected Shell shell;

	/**
	 * Create the dialog.
	 * @param parent
	 * @param style
	 */
	public MenuAdministracion(Shell parent, int style) {
		super(parent, style);
		setText("SWT Dialog");
	}

	/**
	 * Open the dialog.
	 * @return the result
	 */
	public Object open() {
		createContents();
		shell.open();
		shell.layout();
		Display display = getParent().getDisplay();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		return result;
	}

	/**
	 * Create contents of the dialog.
	 */
	private void createContents() {
		shell = new Shell(getParent(), getStyle());
		shell.setSize(450, 300);
		shell.setText(getText());
		
		Button button = new Button(shell, SWT.NONE);
		button.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				MenuProductos m = new MenuProductos(shell, shell.getStyle());
				m.open();
			}
		});
		button.setText("Gestion de Articulos");
		button.setBounds(102, 67, 237, 28);
		
		Button button_1 = new Button(shell, SWT.NONE);
		button_1.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				MainCliente menu = new MainCliente (shell, shell.getStyle());
				menu.open();
			}
		});
		button_1.setText("Gestion de Clientes");
		button_1.setBounds(102, 116, 237, 28);
		
		Button button_2 = new Button(shell, SWT.NONE);
		button_2.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				AgregarEmpleado a = new AgregarEmpleado (shell, shell.getStyle());
				a.open();
			}
		});
		button_2.setText("Agregar Nuevo Usuario/Empleado");
		button_2.setBounds(106, 164, 233, 28);

	}

}
